{extend name='admin@main'}

{block name="button"}
{if auth("add")}
<button data-open='{:url("add")}' data-title="添加新闻" class='layui-btn layui-btn-sm layui-btn-primary'>添加新闻</button>
{/if}
<!--{if auth("remove")}-->
<!--<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除新闻</button>-->
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='news/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class="text-center">ID</th>
            <th class="text-center">分类名称</th>
            <th class="text-center">LGOG</th>
            <th class="text-center">标题</th>
            <th class="text-center">创建时间</th>
            <th class="text-center">操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='text-center nowrap'>
                {$vo.id}
            </td>
            <td class='text-center nowrap'>
                {$vo.name|default=''}
            </td>
            <td class='text-center nowrap'>
                {notempty name='vo.logo'}
                <img data-tips-image style="width:60px;height:60px" src="{$vo.logo|default=''}"
                     class="margin-right-5 text-top">
                {/notempty}
            </td>
            <td class='text-center nowrap'>
                {$vo.title|default=''}
            </td>
            <td class='text-center nowrap'>{$vo.create_at}</td>
            <td class='text-center nowrap'>

                <div class="nowrap margin-bottom-5">
                    {if auth("edit")}
                    <a data-title="编辑新闻" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    {/if}
                    {if $vo.status eq 1 and auth("forbid")}
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
                    {elseif auth("resume")}
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
                    {/if}

                    {if auth("remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                    {/if}
                </div>


                <div class="nowrap margin-bottom-5">

                    {if $vo.is_index eq 1}
                    <a class="layui-btn layui-btn-sm layui-btn-normal" data-confirm="确认要取消首页展示吗？" data-action="{:url('cancelIndex')}" data-value="id#{$vo.id};status#0">取消首页展示</a>
                    {else}
                    <a class="layui-btn layui-btn-sm layui-btn-normal" data-confirm="确认要设置首页展示吗？" data-action="{:url('setIndex')}" data-value="id#{$vo.id};status#1">设置首页展示</a>
                    {/if}
                </div>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}
